package cn.drenal.capcap.controller.forum;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.drenal.capcap.common.Response;
import cn.drenal.capcap.entity.Artwork;
import cn.drenal.capcap.entity.Category;
import cn.drenal.capcap.service.CategoryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 前台分类控制器
 */

@RestController
@RequestMapping("/forum/category")
@RequiredArgsConstructor
public class ForumCategoryController {

    private final CategoryService categoryService;
    /**
     * 获取游戏圈列表
     *
     * @param size 获取数量
     * @return 萌新求助作品列表
     */
    @SaIgnore
    @GetMapping("/games")
    public Response<List<Category>> getGames(@RequestParam(defaultValue = "6") Integer size) {
        return Response.success(categoryService.list(new LambdaQueryWrapper<Category>().last("limit " + size)));
    }
}
